package com.oss.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author cyt
 * @create 2020-05-05 11:37
 */

// 读取配置类
@Component
public class Constant implements InitializingBean {

    @Value("${aliyun.oss.file.endpoint}")
    private String endpoint;

    @Value("${aliyun.oss.file.keyid}")
    private String keyid;

    @Value("${aliyun.oss.file.keysecret}")
    private String keySecret;

    @Value("${aliyun.oss.file.bucketname}")
    private String bucketname;


    public static String END_POINT;
    public static String KEY_ID;

    public static String BUCKET_NAME;
    public static String KEY_SECRET;

    // 把属性全部调整为 公有的
    @Override
    public void afterPropertiesSet() throws Exception {
        END_POINT = endpoint;
        KEY_ID = keyid;
        BUCKET_NAME = bucketname;
        KEY_SECRET = keySecret;
    }
}
